<@_sysRole id=id>
	<#assign a=object/>
</@_sysRole>
<div class="pageContent">
	<form method="post" action="sysRole/save.do?callbackType=closeCurrent&navTabId=sysRole/list" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
		<input name="id" type="hidden" value="${id!}" />
		<div class="pageFormContent" layoutH="57">
			<dl class="nowrap">
				<dt>名称:</dt>
				<dd>
					<input class="required" name="name" type="text" maxlength="20" size="20" value="${(a.name)!}"/>
				</dd>
			</dl>
			<dl class="nowrap">
				<dt>权限:</dt>
				<dd>
					<label><input name="ownsAllRight" type="checkbox" onclick="if($(this).is(':checked')){$('.ownsAllRight').hide();}else{$('.ownsAllRight').show();}"/>拥有所有功能权限</label>
				</dd>
			</dl>
<#macro moudleTree parentId>
	<@_sysMoudleList parentId=parentId>
		<#if page.totalCount gt 0>
			<ul>
				<#list page.list as a>
					<li>
						<a tname="moudleIds" tvalue="${a.id}">${a.name}</a>
						<@moudleTree a.id/>
					</li>
				</#list>
			</ul>
		</#if>
	</@_sysMoudleList>
</#macro>
			<fieldset class="ownsAllRight">
				<legend>模块授权</legend>
				<dl class="nowrap">
					<dt>查看权限:</dt>
					<dd>
						<label><input name="showAllMoudle" type="checkbox"/>显示所有模块</label>
					</dd>
				</dl>
				<ul class="tree treeCheck expand">
					<li>
						<a href="javascript:;" onclick="return false;">所有模块</a>
						<ul>
					<@_sysMoudleList>
						<#list page.list as a>
							<li>
								<a tname="moudleIds" tvalue="${a.id}">${a.name}</a>
								<@moudleTree a.id/>
							</li>
						</#list>
					</@_sysMoudleList>
						</ul>
					</li>
				</ul>
<#if a??>
<script>
	<#if a.ownsAllRight>
	$('input[name=ownsAllRight]',navTab.getCurrentPanel()).click();
	</#if>
	<#if a.showAllMoudle>
	$('input[name=showAllMoudle]',navTab.getCurrentPanel()).click();
	</#if>
	<@_sysRoleMoudleList roleId=a.id>
		<#list page.list as a>
	$('.tree li a[tname=moudleIds][tvalue=${a.moudleId?js_string}]',navTab.getCurrentPanel()).attr('checked','checked');
		</#list>
	</@_sysRoleMoudleList>
</script>
</#if>
			</fieldset>
		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
				<li><div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div></li>
			</ul>
		</div>
	</form>
</div>